<html>
<head><meta charset="utf-8"><title>Missing lang items when exposing Backtrace in core · t-compiler/help · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/index.html">t-compiler/help</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html">Missing lang items when exposing Backtrace in core</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="231807014"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231807014" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231807014">(Mar 25 2021 at 14:11)</a>:</h4>
<p>Hello, <br>
<a class="stream" data-stream-id="257204" href="/#narrow/stream/257204-project-error-handling">#project-error-handling</a> is currently exposing <code>Backtrace</code> in <code>core</code>. <span class="user-mention" data-user-id="220273">@Jane Lusby</span> did most of the implementation and I am trying to bring it to a conclusion. The lang items are defined and then exposed in the <code>std</code> with the <code>#[export_name]</code> tag, however the compiler is still unable to find them when linking.  Relevant <a href="https://github.com/rust-lang/rust/pull/77384">PR</a></p>



<a name="231811168"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231811168" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231811168">(Mar 25 2021 at 14:32)</a>:</h4>
<p>the errors are like this:</p>
<div class="codehilite"><pre><span></span><code>error: language item required, but not found: `backtrace_create`
</code></pre></div>



<a name="231811899"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231811899" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jonas Schievink  [he/him] <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231811899">(Mar 25 2021 at 14:36)</a>:</h4>
<p>that means the <code>#[lang_item]</code> is missing, it's not a linkage problem</p>



<a name="231813478"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231813478" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231813478">(Mar 25 2021 at 14:44)</a>:</h4>
<p>There must be something else missing as they are exported from <code>core</code> and the special mangled names are present for them in <code>std</code></p>



<a name="231813779"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231813779" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231813779">(Mar 25 2021 at 14:46)</a>:</h4>
<p>I'm not sure we ever had external items be lang items</p>



<a name="231813854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231813854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231813854">(Mar 25 2021 at 14:46)</a>:</h4>
<p>The lang item logic may simply skip over them and thus not pick them up</p>



<a name="231814752"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231814752" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231814752">(Mar 25 2021 at 14:51)</a>:</h4>
<p>it is  resolved <a href="https://github.com/rust-lang/rust/blob/master/compiler/rustc_middle/src/middle/lang_items.rs">here</a> right?</p>



<a name="231815219"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231815219" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231815219">(Mar 25 2021 at 14:54)</a>:</h4>
<p>That's the access part. The lang items are collected in <a href="https://github.com/rust-lang/rust/blob/dff1edf919198aa4dea106e63b7d1899f1061fe0/compiler/rustc_passes/src/lang_items.rs#L210">https://github.com/rust-lang/rust/blob/dff1edf919198aa4dea106e63b7d1899f1061fe0/compiler/rustc_passes/src/lang_items.rs#L210</a></p>



<a name="231815294"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231815294" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231815294">(Mar 25 2021 at 14:54)</a>:</h4>
<p>And <a href="https://github.com/rust-lang/rust/blob/dff1edf919198aa4dea106e63b7d1899f1061fe0/compiler/rustc_passes/src/lang_items.rs#L49">https://github.com/rust-lang/rust/blob/dff1edf919198aa4dea106e63b7d1899f1061fe0/compiler/rustc_passes/src/lang_items.rs#L49</a> explicitly skips over extern items</p>



<a name="231816894"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231816894" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231816894">(Mar 25 2021 at 15:01)</a>:</h4>
<p>My knowledge of compiler is superficial <span aria-label="blush" class="emoji emoji-1f60a" role="img" title="blush">:blush:</span> Does that mean all <code>extern "Rust"</code> items are skipped and the <code>panic</code> ones are served in a special compiler mechanism that is why they are not ignored?</p>



<a name="231818706"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231818706" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231818706">(Mar 25 2021 at 15:10)</a>:</h4>
<p>I think <a href="https://github.com/rust-lang/rust/pull/77384/files#r601577631">this</a> is the issue.</p>



<a name="231819639"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231819639" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231819639">(Mar 25 2021 at 15:15)</a>:</h4>
<p>Yes! This did help. I am guessing that because <code>panic</code> works in a different way it also looks for the underscores in the resolution of the symbol?</p>



<a name="231819974"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231819974" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231819974">(Mar 25 2021 at 15:17)</a>:</h4>
<p>Or it did not...</p>



<a name="231820056"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231820056" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231820056">(Mar 25 2021 at 15:17)</a>:</h4>
<p>stage0 passed and stage1 failed</p>



<a name="231820103"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231820103" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231820103">(Mar 25 2021 at 15:17)</a>:</h4>
<p>again with the same symptoms</p>



<a name="231835559"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231835559" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231835559">(Mar 25 2021 at 16:45)</a>:</h4>
<p>It seems like this does not change anything <span aria-label="frown" class="emoji emoji-1f641" role="img" title="frown">:frown:</span> I only trigger rebuilds (that is what made me suspicious)</p>



<a name="231926089"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/182449-t-compiler/help/topic/Missing%20lang%20items%20when%20exposing%20Backtrace%20in%20core/near/231926089" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jakub Duchniewicz <a href="https://rust-lang.github.io/zulip_archive/stream/182449-t-compiler/help/topic/Missing.20lang.20items.20when.20exposing.20Backtrace.20in.20core.html#231926089">(Mar 26 2021 at 07:50)</a>:</h4>
<p>where should I dig around to understand how the compiler implements this, so that I may <em>try</em> understanding what is the issue on my own? The <code>rustc_passes/src/lang_items</code> I presume?</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>